package com.freesky.provider.search.config;

import com.freesky.common.vo.SolrInfo;
import lombok.Getter;
import lombok.Setter;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocumentList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: 陈玉林
 * @modifiedBy:
 * @date: Create In 16:28 2018/11/29
 * @description:
 */
@Configuration
public class SolrConfig {
    private SolrClient client;
    @Value("${solr.url}")
    private String url;
    @Bean
    public SolrClient client() {
        if (client == null) {
            client = new HttpSolrClient.Builder(url).withConnectionTimeout(10000).withSocketTimeout(180000).build();
        }
        return this.client;
    }
}
